﻿#region

using System.Collections.Generic;
using BTL.OnlineTestingSocial.Domain.TestingEngine;
using BTL.OnlineTestingSocial.Services.TestingEngine.Service.DAL;
using BTL.Technology.Framework;

#endregion

namespace BTL.OnlineTestingSocial.Services.TestingEngine.Service.BLL
{
    public class QuestionGroupManager : IQuestionGroupManager
    {
        private readonly IQuestionGroupRepository _questionGroupRepository;

        public QuestionGroupManager(IQuestionGroupRepository questionGroupRepository)
        {
            _questionGroupRepository = questionGroupRepository;
        }

        #region QuestionGroupManager Members

        public IEnumerable<QuestionGroupItem> GetPrivateQuestionGroups(int userId, int pageSize, int pageNum)
        {
            Guard.MakeSureAllInstancesIsNullNot(_questionGroupRepository);

            return _questionGroupRepository.GetPrivateQuestionGroups(userId, pageSize, pageNum);
        }

        public IEnumerable<QuestionGroupItem> GetPublicQuestionGroups(int userId, int pageSize, int pageNum)
        {
            Guard.MakeSureAllInstancesIsNullNot(_questionGroupRepository);

            return _questionGroupRepository.GetPublicQuestionGroups(userId, pageSize, pageNum);
        }

        public bool DeleteQuestionGroupSp(string ids)
        {
            Guard.MakeSureAllInstancesIsNullNot(_questionGroupRepository);

            return _questionGroupRepository.DeleteQuestionGroupSp(ids);
        }

        public QuestionGroupItem GetDetail(int questionGroupId)
        {
            Guard.MakeSureAllInstancesIsNullNot(_questionGroupRepository);

            return _questionGroupRepository.GetDetail(questionGroupId);
        }

        #endregion
    }
}